<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../VueJs/vue.js"></script>
</head>

<body>
    <div id="root">
        <h1>今天的天气很{{info}}</h1>
        <!-- 绑定事件的时候：@xxx="yyy" yyy可以写一些简单的语句 -->
        <!-- <button @click="isHot=!isHot">天气切换</button> -->
        <button @click="switchWeather">天气切换</button>
    </div>
</body>
<script>
    Vue.config.productionTip = false;
    Vue.config.devtools = true;
    let flag = true;
    const vm = new Vue({
        el: '#root',
        data: {
            isHot: true,
        },
        methods: {
            switchWeather() {
                this.isHot = !this.isHot;
            }
        },
        computed: {
            info() {
                return this.isHot ? "炎热" : '凉爽';
            }
        }
    });
</script>

</html>